﻿@using AiXiu.Model
@model List<TBVideos>
@{
    ViewBag.Title = "MyVideos";
}

<div class="page" data-page="myvideos">
    <div class="page-content">
        <div class="block-title">我发布的视频</div>
        <div class="list media-list margin-top-none">
            <ul>
                @foreach (TBVideos video in Model)
                {
                    string cover = !string.IsNullOrEmpty(video.CoverURL) ? video.CoverURL : "/imgs/square.jpg";
                    string status = "未知";
                    switch (video.Status)
                    {
                        case 1:
                            status = "上传中";
                            break;
                        case 2:
                            status = "上传失败";
                            break;
                        case 3:
                            status = "上传完成";
                            break;
                        case 4:
                            status = "转码中";
                            break;
                        case 5:
                            status = "转码失败";
                            break;
                        case 6:
                            status = "屏蔽";
                            break;
                        case 7:
                            status = "正常";
                            break;
                    }
                    <li class="swipeout deleted-callback" data-id="@video.VideoId">
                        <div class="item-content swipeout-content">
                            <div class="item-media">
                                <img src="@cover" width="44" />
                            </div>
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">@video.Headline</div>
                                </div>
                                <div class="item-subtitle">@status</div>
                            </div>
                        </div>
                        <div class="swipeout-actions-right">
                            <a href="#" class="swipeout-delete">删除</a>
                        </div>
                    </li>

                }
            </ul>
        </div>
    </div>
</div>

@section footScript{
    <script>
        // 删除视频时，异步删除完整视频文件
        $$('.deleted-callback').on('swipeout:deleted', function () {
            var videoId = $$(this).data('id');
            app.request.get('@Url.Action("VideoDelete", "Video")', { videoId: videoId });
        });
    </script>
}